//引入路由组件
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySucess from '@/pages/PaySuccess'
import Center from '@/pages/Center'
import groupOrder from '@/pages/Center/groupOrder'
import myOrder from '@/pages/Center/myOrder'




export default [
    {
        path:'/home',
        component: Home,
        meta:{show:true}

    },
    {
        path: '/center',
        component:Center,
        meta: { show: true },
        children: [
           
            {
                path: 'myorder',
                component: myOrder,
            }
            ,
            {
                path: 'grouporder',
                component: groupOrder,
            }
            ,
            {
                path: '/center',
                redirect: '/center/myorder'
            }
        ]
      
    },
  
    {
        path: '/paysuccess',
        component: PaySucess,
        meta: { show: true }
    },
    {
        path:'/pay',
        component: Pay,
        meta:{show:true}

    },
    {
        path:'/trade',
        component: Trade,
        meta:{show:true}

    },
    {
        path:'/shopcart',
        name:"shopcart",
        component:ShopCart,
        meta:{show:true}

    },
    {
        path:'/addCartSuccess',
        name:'addCartSuccess',
        component: AddCartSuccess,
        meta:{show:true}

    },
    {
        name:'search',
        path:'/search/:keyword?',
        component:Search,
        meta:{show:true},
        props: (route) => ({ keyWord: route.params.keyWord, k: route.query.k })
    },    
   
    {
        path:'/login',
        component:Login,
        meta:{show:false}
    },
    {
        path:'/register',
        component:Register,
        meta:{show:false}
    },
    {
        path:'/detail/:skuid',
        component:Detail,
        meta:{show:true}
    },
    //重定向，在项目跑起来的时候，立刻定向到首页
    {
        path:'*',
        redirect:'/home'

    }
]